package com.fll.fangyiuser;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;

@MapperScan("com.fll.fangyiuser.dao")
@EnableFeignClients
@SpringBootApplication
@EnableDiscoveryClient
//添加好友时的事务处理
@EnableTransactionManagement
public class FangyiUserApplication {

    public static void main(String[] args) {
        SpringApplication.run(FangyiUserApplication.class, args);
    }

//    @Bean
//    public RestTemplate restTemplate(RestTemplateBuilder builder) {
//        return builder.build();
//    }

    /**
     * 创建RestTemplate并注入Spring容器
     */
    @Bean
//    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
